# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=iio-sensor-proxy
pkgver=3.5
pkgrel=1
pkgdesc="IIO sensors to D-Bus proxy"
url="https://gitlab.freedesktop.org/hadess/iio-sensor-proxy"
arch="all"
license="GPL-2.0-or-later"
depends="dbus"
makedepends="
	eudev-dev
	glib-dev
	libgudev-dev
	meson
	polkit-dev
	"
subpackages="$pkgname-openrc"
source="https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/uploads/ae095b693b6317f14dfa4212c5c36c1a/iio-sensor-proxy-3.5.tar.xz
	iio-sensor-proxy.initd
	"
build() {
	abuild-meson \
		-Db_lto=true \
		-Dsystemdsystemunitdir=/no \
		. output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
	rm -r "$pkgdir"/no

	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
}

sha512sums="
eb08b0684421000c267e6ce03072a383930c35e3fee7f4a619e60f12a2d24e29896e9bd1ee27e1faf0aa8d3018127a89e83ce3586db71cc45a00e19e1365b7db  iio-sensor-proxy-3.5.tar.xz
b25df94e249ca46fe96926e5a866c20dc913fa52a2d9259fb7a3594861c6b2f246fc7fef8a21f5b021f3a71401f734ae27210137b0b1917a7daaffb5e3221f2e  iio-sensor-proxy.initd
"
